﻿using Furion.Schedule;
using Furion;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;

namespace WebApplication2;

public class Startup : AppStartup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddJwt<JwtHandler>();
        services.AddControllers();
        services.AddDynamicApiControllers();
        services.AddSpecificationDocuments();
        services.AddEventBus(); //事件总线
        services.AddTaskQueue(); //任务队列 
        services.AddMemoryCache(); //缓存
        services.AddCorsAccessor(); //跨域
        services.AddHttpClient(); // http请求业  

    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        app.EnableBuffering(); // 启用Body重复读功能
        app.UseCorsAccessor();
        app.UseRouting();
        app.UseAuthentication();
        app.UseAuthorization();
        app.UseStaticFiles();
        app.UseScheduleUI();
        app.UseSpecificationDocuments(); 
        app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
    }
}